#ifndef _AUDIO_MANAGER_H
#define _AUDIO_MANAGER_H

#include "SFML\Audio.hpp"
#include "ResourceLoadTypes.h"

#include <map>
#include <string>


class AudioManager
{
public:
	typedef sf::SoundBuffer* (AudioManager::*LoadAudioFptr)(const std::string& filepath, const std::string& id);

	static AudioManager* getSingletonPtr();
	static void cleanSingleton();

	sf::SoundBuffer* loadSound(const std::string& filepath, const std::string& id);

	void setMode(int);

	void unloadSound(const std::string&);
	void unloadAllSounds();

private:
	AudioManager(void);
	~AudioManager(void);

	static AudioManager* _instance;

	inline sf::SoundBuffer* loadSoundFromArchive(const std::string& filepath, const std::string& id);
	inline sf::SoundBuffer* loadSoundFromFile(const std::string& filepath, const std::string& id);

	sf::SoundBuffer* doesSoundExist(const std::string& id);
	std::map<std::string, sf::SoundBuffer*> _soundFX;
	int _mode;
	LoadAudioFptr _loadAudioFptr[RESOURCE_SIZE];
};

#endif // _AUDIO_MANAGER_H

